package com.one.rope.mvp.web.common.dto.admin.push;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.one.rope.mvp.basecore.util.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.Data;

/**
 * @author Weijian.Liu
 * @desc 会员推送任务列表返回
 * @date 2020/2/21 16:44
 */
@Data
@ApiModel
public class AdminMemberPushListItemVO {

  @ApiModelProperty(value = "推送id")
  private Long id;

  @ApiModelProperty(value = "任务名称")
  private String name;

  @ApiModelProperty(value = "推送页面地址")
  @JsonProperty("page_url")
  private String pageUrl;

  @ApiModelProperty(value = "推送类型(1:推送简历页 2:推送岗位详情页)")
  @JsonProperty("push_type")
  private Integer pushType;

  @ApiModelProperty(value = "推送目标")
  @JsonProperty("push_target")
  private String pushTarget;

  @ApiModelProperty(value = "推送目标")
  @JsonProperty("push_target_id")
  private String pushTargetId;

  @JsonIgnore
  @ApiModelProperty(value = "会员名称")
  private String memberName;

  @JsonIgnore
  @ApiModelProperty(value = "企业名称")
  private String companyName;

  @ApiModelProperty(value = "推送状态(1-待推送 2-推送成功 3-推送失败)")
  private Integer status;

  @ApiModelProperty(value = "创建时间")
  @JsonProperty("create_time")
  private Date createTime;

  public String getPushTarget() {
    if (!StringUtils.isNullOrEmpty(companyName)) {
      return memberName + "-" + companyName;
    }
    return memberName;
  }
}
